package me.leiusual.sharing.api.model

/**
 * author: leiusual
 * create on: 2019-07-25
 * description:
 */
class StoreCategories {

  data class Request(
      val clientId: String,
      val parentCategoryId: Long?,
      val storeId: Long
  )

  data class Response(
      val clientId: String,
      val storeId: Long,
      val parentCategoryId: Long?,
      val childCategories: List<Category>
  ) {

    fun toCategoryList(): List<Category.Item> {
      val list = mutableListOf<Category.Item>()
      childCategories.forEach {
        list.addAll(it.list)
      }
      return list
    }

    data class Category(
        val selected: Any?,
        val list: List<Item>
    ) {

      data class Item(
          val id: Long,
          val name: String
      )
    }
  }
}